package com.tomcov.shared;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable
public class Journey implements Serializable{
	
	private static final long serialVersionUID = 1L;
	
	@SuppressWarnings("unused")
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	@Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true")
	private String id;
	
	@Persistent public String From;
	@Persistent public String To;
	@Persistent public String Driver;
	@Persistent public Date date;
	@Persistent public List<String> Passenger;

	public Journey(){
	
	}
	public Journey(String From,String To, String Driver,Date date){
		this.From=From;
		this.To=To;
		this.Driver=Driver;
		this.date=date;
	}
	public String getFrom() {
		return From;
	}
	public void setFrom(String from) {
		From = from;
	}
	public String getTo() {
		return To;
	}
	public void setTo(String to) {
		To = to;
	}
	public String getDriver() {
		return Driver;
	}
	public void setDriver(String driver) {
		Driver = driver;
	}
	public boolean addPassenger(String Passenger){
		if(this.Passenger.size()<4){
		this.Passenger.add(Passenger);
		return true;
		}
		else return false;	
	}
	
	public List<String> getPassengerList(){
		return Passenger;
	}
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
}
